package Selenium;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

/**
 * created by zhangyuhang on 2018/7/13
 */
public class ActionSelenium {

    public WebDriver driver;

    public void InitDriver() {
        driver = new ChromeDriver();
        driver.get("http://www.imooc.com/user/newlogin/from_url/");
        driver.manage().window().maximize();
    }

    //输入框的操作
    public void inputBox() throws InterruptedException {
        driver.findElement(By.name("email")).sendKeys("18258830825");
        Thread.sleep(2000);
        driver.findElement(By.name("email")).clear();
        String s = driver.findElement(By.name("email")).getAttribute("placeholder");
        System.out.println("s  ....." + s);
        //driver.get("http://www.imooc.com/");
    }

    public void loginMk() {
        driver.findElement(By.name("email")).sendKeys("18258830825");
        driver.findElement(By.name("password")).sendKeys("a34558818");
        driver.findElement(By.className("moco-btn-red")).click();
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    //单选框
    public void radioBox() {

        driver.get("http://www.imooc.com/user/setprofile");
        driver.findElement(By.className("pull-right")).click();
        driver.findElement(By.xpath("//*[@id=\"profile\"]/div[4]/div/label[2]/input")).click();
        driver.findElement(By.xpath("//*[@id=\"profile-submit\"]")).click();

    }

    public static void main(String args[]) throws InterruptedException {
        ActionSelenium actionSelenium = new ActionSelenium();
        actionSelenium.InitDriver();
        actionSelenium.loginMk();
        actionSelenium.radioBox();
    }

}
